const getUserApi = () => new Promise((resolve) => {
    console.log('use getUserApi');
    setTimeout(() => {
        resolve(JSON.stringify({
            code: 200,
            message: '获取成功',
            success: true,
            data: {
                name: '张三',
                age: 18,
                gender: 1
            }
        }))
    }, 500)
})

let fetch = null

const getUser = async () => {
    if(fetch) return fetch
    fetch = getUserApi()
    try {
     const res = await fetch
     console.log('res', res);
    //  fetch = null
     return res
    } catch (error) {
        console.log('error', error);
    }
    fetch = null
}

const promiseList = new Array(10).fill(getUser())

Promise.all(promiseList).then(res => {
    console.log('promiseList res:', res);
})